home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15489 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.2 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 6e 6f | 63 2e 6e 65 74 63 6f 6d |Path: no|c.netcom|
|00000010| 2e 6e 65 74 21 6e 65 77 | 73 0a 46 72 6f 6d 3a 20 |.net!new|s.From: |
|00000020| 54 61 72 61 6e 67 20 44 | 65 73 68 70 61 6e 64 65 |Tarang D|eshpande|
|00000030| 20 3c 74 61 72 61 6e 67 | 40 77 69 6c 6c 6f 77 73 | <tarang|@willows|
|00000040| 2e 63 6f 6d 3e 0a 4e 65 | 77 73 67 72 6f 75 70 73 |.com>.Ne|wsgroups|
|00000050| 3a 20 63 6f 6d 70 2e 6c | 61 6e 67 2e 63 0a 53 75 |: comp.l|ang.c.Su|
|00000060| 62 6a 65 63 74 3a 20 52 | 65 3a 20 50 72 6f 62 6c |bject: R|e: Probl|
|00000070| 65 6d 20 77 2f 73 69 6d | 70 6c 65 20 6c 69 6e 6b |em w/sim|ple link|
|00000080| 65 64 20 6c 69 73 74 0a | 44 61 74 65 3a 20 54 68 |ed list.|Date: Th|
|00000090| 75 2c 20 31 38 20 41 70 | 72 20 31 39 39 36 20 31 |u, 18 Ap|r 1996 1|
|000000a0| 37 3a 35 35 3a 34 30 20 | 2d 30 37 30 30 0a 4f 72 |7:55:40 |-0700.Or|
|000000b0| 67 61 6e 69 7a 61 74 69 | 6f 6e 3a 20 4e 45 54 43 |ganizati|on: NETC|
|000000c0| 4f 4d 20 4e 65 74 77 6f | 72 6b 20 4f 70 65 72 61 |OM Netwo|rk Opera|
|000000d0| 74 69 6f 6e 73 0a 4d 65 | 73 73 61 67 65 2d 49 44 |tions.Me|ssage-ID|
|000000e0| 3a 20 3c 33 31 37 36 45 | 34 38 43 2e 33 45 37 42 |: <3176E|48C.3E7B|
|000000f0| 40 77 69 6c 6c 6f 77 73 | 2e 63 6f 6d 3e 0a 52 65 |@willows|.com>.Re|
|00000100| 66 65 72 65 6e 63 65 73 | 3a 20 3c 34 6c 35 65 68 |ferences|: <4l5eh|
|00000110| 61 24 35 71 61 40 6e 65 | 77 73 2e 64 75 6b 65 2e |a$5qa@ne|ws.duke.|
|00000120| 65 64 75 3e 0a 4e 4e 54 | 50 2d 50 6f 73 74 69 6e |edu>.NNT|P-Postin|
|00000130| 67 2d 48 6f 73 74 3a 20 | 64 61 66 66 79 2e 77 69 |g-Host: |daffy.wi|
|00000140| 6c 6c 6f 77 73 2e 63 6f | 6d 0a 4d 69 6d 65 2d 56 |llows.co|m.Mime-V|
|00000150| 65 72 73 69 6f 6e 3a 20 | 31 2e 30 0a 43 6f 6e 74 |ersion: |1.0.Cont|
|00000160| 65 6e 74 2d 54 79 70 65 | 3a 20 74 65 78 74 2f 70 |ent-Type|: text/p|
|00000170| 6c 61 69 6e 3b 20 63 68 | 61 72 73 65 74 3d 75 73 |lain; ch|arset=us|
|00000180| 2d 61 73 63 69 69 0a 43 | 6f 6e 74 65 6e 74 2d 54 |-ascii.C|ontent-T|
|00000190| 72 61 6e 73 66 65 72 2d | 45 6e 63 6f 64 69 6e 67 |ransfer-|Encoding|
|000001a0| 3a 20 37 62 69 74 0a 58 | 2d 4d 61 69 6c 65 72 3a |: 7bit.X|-Mailer:|
|000001b0| 20 4d 6f 7a 69 6c 6c 61 | 20 32 2e 30 47 6f 6c 64 | Mozilla| 2.0Gold|
|000001c0| 42 32 20 28 57 69 6e 39 | 35 3b 20 49 29 0a 54 6f |B2 (Win9|5; I).To|
|000001d0| 3a 20 53 74 65 76 65 20 | 4b 69 6e 67 20 3c 73 74 |: Steve |King <st|
|000001e0| 6b 69 6e 67 40 61 63 70 | 75 62 2e 64 75 6b 65 2e |king@acp|ub.duke.|
|000001f0| 65 64 75 3e 0a 0a 53 74 | 65 76 65 20 4b 69 6e 67 |edu>..St|eve King|
|00000200| 20 77 72 6f 74 65 3a 0a | 3e 20 0a 3e 20 2f 2a 20 | wrote:.|> .> /* |
|00000210| 46 75 6e 63 74 69 6f 6e | 20 74 6f 20 77 61 6c 6b |Function| to walk|
|00000220| 20 74 68 72 6f 75 67 68 | 20 6c 69 73 74 20 61 6e | through| list an|
|00000230| 64 20 63 68 65 63 6b 20 | 66 6f 72 20 61 20 22 6d |d check |for a "m|
|00000240| 61 74 63 68 22 20 2a 2f | 0a 3e 20 73 74 72 75 63 |atch" */|.> struc|
|00000250| 74 20 41 50 4c 49 53 54 | 20 2a 20 46 69 6e 64 49 |t APLIST| * FindI|
|00000260| 6e 4c 69 73 74 28 0a 3e | 20 63 6f 6e 73 74 20 73 |nList(.>| const s|
|00000270| 74 72 75 63 74 20 41 50 | 4c 49 53 54 20 2a 6e 6f |truct AP|LIST *no|
|00000280| 64 65 2c 0a 3e 20 63 6f | 6e 73 74 20 63 68 61 72 |de,.> co|nst char|
|00000290| 20 2a 20 6e 61 6d 65 29 | 0a 3e 20 7b 0a 3e 20 20 | * name)|.> {.> |
|000002a0| 20 20 73 74 72 75 63 74 | 20 41 50 4c 49 53 54 20 | struct| APLIST |
|000002b0| 2a 20 77 61 6c 6b 3b 0a | 3e 20 20 20 20 73 74 72 |* walk;.|> str|
|000002c0| 75 63 74 20 41 50 4c 49 | 53 54 20 2a 20 70 72 65 |uct APLI|ST * pre|
|000002d0| 76 69 6f 75 73 3b 0a 3e | 20 20 20 20 66 6f 72 20 |vious;.>| for |
|000002e0| 28 77 61 6c 6b 20 3d 20 | 6e 6f 64 65 2c 20 70 72 |(walk = |node, pr|
|000002f0| 65 76 69 6f 75 73 20 3d | 20 4e 55 4c 4c 3b 20 77 |evious =| NULL; w|
|00000300| 61 6c 6b 3b 20 77 61 6c | 6b 20 3d 20 77 61 6c 6b |alk; wal|k = walk|
|00000310| 2d 3e 6e 65 78 74 29 0a | 3e 20 20 20 20 7b 0a 3e |->next).|> {.>|
|00000320| 20 20 20 20 20 20 20 69 | 66 20 28 73 74 72 63 6d | i|f (strcm|
|00000330| 70 28 77 61 6c 6b 2d 3e | 70 61 74 69 65 6e 74 2e |p(walk->|patient.|
|00000340| 6e 61 6d 65 2c 6e 61 6d | 65 29 20 3d 3d 20 30 29 |name,nam|e) == 0)|
|00000350| 0a 3e 20 20 20 20 20 20 | 20 7b 0a 3e 20 20 20 20 |.> | {.> |
|00000360| 20 20 20 20 20 20 72 65 | 74 75 72 6e 28 70 72 65 | re|turn(pre|
|00000370| 76 69 6f 75 73 29 3b 0a | 3e 20 20 20 20 20 20 20 |vious);.|> |
|00000380| 7d 0a 3e 20 20 20 20 7d | 0a 3e 20 20 20 20 70 72 |}.> }|.> pr|
|00000390| 65 76 69 6f 75 73 20 3d | 20 77 61 6c 6b 3b 0a 3e |evious =| walk;.>|
|000003a0| 20 20 20 20 72 65 74 75 | 72 6e 28 4e 55 4c 4c 29 | retu|rn(NULL)|
|000003b0| 3b 0a 3e 20 7d 0a 0a 59 | 6f 75 27 6c 6c 20 6e 6f |;.> }..Y|ou'll no|
|000003c0| 74 65 20 74 68 61 74 20 | 77 69 74 68 69 6e 20 74 |te that |within t|
|000003d0| 68 65 20 66 6f 72 20 6c | 6f 6f 70 20 70 72 65 76 |he for l|oop prev|
|000003e0| 69 6f 75 73 20 69 73 20 | 61 6c 77 61 79 73 20 4e |ious is |always N|
|000003f0| 55 4c 4c 20 73 6f 20 49 | 20 74 68 69 6e 6b 0a 79 |ULL so I| think.y|
|00000400| 6f 75 20 77 61 6e 74 20 | 74 6f 20 6d 6f 76 65 20 |ou want |to move |
|00000410| 70 72 65 76 69 6f 75 73 | 20 3d 20 77 61 6c 6b 20 |previous| = walk |
|00000420| 69 6e 74 6f 20 74 68 65 | 20 6c 6f 6f 70 2e 20 20 |into the| loop. |
|00000430| 48 6f 77 65 76 65 72 20 | 74 68 69 73 20 73 74 69 |However |this sti|
|00000440| 6c 6c 20 0a 6c 65 61 76 | 65 73 20 79 6f 75 20 77 |ll .leav|es you w|
|00000450| 69 74 68 20 6f 6e 65 20 | 70 72 6f 62 6c 65 6d 3b |ith one |problem;|
|00000460| 20 77 68 61 74 20 68 61 | 70 70 65 6e 73 20 69 66 | what ha|ppens if|
|00000470| 20 74 68 65 20 66 69 72 | 73 74 20 6e 6f 64 65 20 | the fir|st node |
|00000480| 69 73 20 74 68 65 20 63 | 6f 72 72 65 63 74 0a 6f |is the c|orrect.o|
|00000490| 6e 65 3f 20 20 42 75 74 | 20 62 65 63 61 75 73 65 |ne? But| because|
|000004a0| 20 79 6f 75 20 68 61 76 | 65 20 6f 6e 6c 79 20 61 | you hav|e only a|
|000004b0| 20 73 69 6e 67 6c 65 6c | 79 20 6c 69 6e 6b 65 64 | singlel|y linked|
|000004c0| 20 6c 69 73 74 20 69 74 | 20 77 69 6c 6c 20 62 65 | list it| will be|
|000004d0| 20 64 69 66 66 69 63 75 | 6c 74 0a 74 6f 20 70 72 | difficu|lt.to pr|
|000004e0| 6f 70 65 72 6c 79 20 65 | 78 65 63 75 74 65 20 69 |operly e|xecute i|
|000004f0| 66 20 79 6f 75 20 73 74 | 69 6c 6c 20 77 61 6e 74 |f you st|ill want|
|00000500| 20 74 6f 20 75 73 65 20 | 74 68 65 20 72 65 74 75 | to use |the retu|
|00000510| 72 6e 20 76 61 6c 75 65 | 20 6f 66 20 74 68 65 20 |rn value| of the |
|00000520| 66 75 6e 63 74 69 6f 6e | 0a 61 73 20 74 68 65 20 |function|.as the |
|00000530| 69 6e 64 69 63 61 74 6f | 72 2e 20 20 53 6f 20 74 |indicato|r. So t|
|00000540| 68 65 72 65 20 61 72 65 | 20 74 77 6f 20 70 6f 73 |here are| two pos|
|00000550| 73 69 62 6c 65 20 73 6f | 6c 75 74 69 6f 6e 73 3a |sible so|lutions:|
|00000560| 0a 0a 0a 31 2e 20 6d 61 | 6b 65 20 74 68 65 20 6c |...1. ma|ke the l|
|00000570| 69 73 74 20 61 20 64 6f | 75 62 6c 65 6c 79 20 6c |ist a do|ublely l|
|00000580| 69 6e 6b 20 6c 69 73 74 | 20 61 6e 64 20 72 65 74 |ink list| and ret|
|00000590| 75 72 6e 20 77 61 6c 6b | 20 77 68 65 6e 20 74 68 |urn walk| when th|
|000005a0| 65 20 73 74 72 69 6e 67 | 73 20 61 72 65 0a 65 71 |e string|s are.eq|
|000005b0| 75 61 6c 20 61 6e 64 20 | 74 68 65 6e 20 74 61 6b |ual and |then tak|
|000005c0| 65 20 74 68 65 20 72 65 | 74 75 72 6e 20 76 61 6c |e the re|turn val|
|000005d0| 75 65 3b 20 63 61 6c 6c | 20 69 74 20 63 75 72 72 |ue; call| it curr|
|000005e0| 65 6e 74 20 61 6e 64 20 | 64 6f 20 74 68 65 20 66 |ent and |do the f|
|000005f0| 6f 6c 6c 6f 77 69 6e 67 | 3a 0a 0a 09 2e 2e 2e 0a |ollowing|:.......|
|00000600| 09 69 66 20 28 20 63 75 | 72 72 65 6e 74 2d 3e 70 |.if ( cu|rrent->p|
|00000610| 72 65 76 20 29 0a 09 09 | 28 20 28 63 75 72 72 65 |rev )...|( (curre|
|00000620| 6e 74 2d 3e 70 72 65 76 | 29 2d 3e 6e 65 78 74 20 |nt->prev|)->next |
|00000630| 3d 20 63 75 72 72 65 6e | 74 2d 3e 6e 65 78 74 3b |= curren|t->next;|
|00000640| 0a 09 69 66 20 28 20 63 | 75 72 72 65 6e 74 2d 3e |..if ( c|urrent->|
|00000650| 6e 65 78 74 20 29 0a 09 | 09 28 20 28 63 75 72 72 |next )..|.( (curr|
|00000660| 65 6e 74 2d 3e 6e 65 78 | 74 29 2d 3e 70 72 65 76 |ent->nex|t)->prev|
|00000670| 20 3d 20 63 75 72 72 65 | 6e 74 2d 3e 70 72 65 76 | = curre|nt->prev|
|00000680| 3b 0a 09 66 72 65 65 20 | 28 20 63 75 72 72 65 6e |;..free |( curren|
|00000690| 74 20 29 3b 0a 09 2e 2e | 2e 0a 0a 32 2e 20 69 66 |t );....|...2. if|
|000006a0| 20 79 6f 75 20 77 61 6e | 74 20 74 6f 20 6b 65 65 | you wan|t to kee|
|000006b0| 70 20 74 68 65 20 73 69 | 6e 67 6c 65 6c 79 20 6c |p the si|nglely l|
|000006c0| 69 6e 6b 65 64 20 6c 69 | 73 74 20 74 68 65 6e 20 |inked li|st then |
|000006d0| 79 6f 75 20 6d 75 73 74 | 20 74 61 6b 65 20 69 6e |you must| take in|
|000006e0| 74 6f 20 0a 61 63 63 6f | 75 6e 74 20 74 68 65 20 |to .acco|unt the |
|000006f0| 73 70 65 63 69 61 6c 20 | 73 69 74 75 61 74 69 6f |special |situatio|
|00000700| 6e 20 77 68 65 72 65 20 | 74 68 65 20 66 69 72 73 |n where |the firs|
|00000710| 74 20 6e 6f 64 65 20 69 | 73 20 74 68 65 20 6d 61 |t node i|s the ma|
|00000720| 74 63 68 69 6e 67 20 6f | 6e 65 2e 0a 54 68 65 20 |tching o|ne..The |
|00000730| 73 69 6d 70 6c 65 73 74 | 20 77 61 79 20 49 20 63 |simplest| way I c|
|00000740| 61 6e 20 74 68 69 6e 6b | 20 6f 66 20 69 73 20 74 |an think| of is t|
|00000750| 6f 20 6d 6f 76 65 20 74 | 68 65 20 64 65 6c 65 74 |o move t|he delet|
|00000760| 65 20 63 6f 64 65 20 69 | 6e 74 6f 20 74 68 65 0a |e code i|nto the.|
|00000770| 46 69 6e 64 49 6e 4c 69 | 73 74 20 72 6f 75 74 69 |FindInLi|st routi|
|00000780| 6e 65 3a 0a 0a 20 20 20 | 20 20 20 20 20 2e 2e 2e |ne:.. | ...|
|00000790| 0a 09 69 66 20 28 73 74 | 72 63 6d 70 28 77 61 6c |..if (st|rcmp(wal|
|000007a0| 6b 2d 3e 70 61 74 69 65 | 6e 74 2e 6e 61 6d 65 2c |k->patie|nt.name,|
|000007b0| 6e 61 6d 65 29 20 3d 3d | 20 30 29 0a 20 20 20 20 |name) ==| 0). |
|000007c0| 20 20 20 20 7b 0a 09 09 | 69 66 20 28 20 70 72 65 | {...|if ( pre|
|000007d0| 76 69 6f 75 73 20 29 0a | 09 09 09 70 72 65 76 69 |vious ).|...previ|
|000007e0| 6f 75 73 2d 3e 6e 65 78 | 74 20 3d 20 77 61 6c 6b |ous->nex|t = walk|
|000007f0| 2d 3e 6e 65 78 74 3b 0a | 09 09 66 72 65 65 20 28 |->next;.|..free (|
|00000800| 20 77 61 6c 6b 20 29 3b | 0a 20 20 20 20 20 20 20 | walk );|. |
|00000810| 20 09 72 65 74 75 72 6e | 28 20 31 20 29 3b 0a 20 | .return|( 1 );. |
|00000820| 20 20 20 20 20 20 20 7d | 0a 09 2e 2e 2e 0a 09 72 | }|.......r|
|00000830| 65 74 75 72 6e 20 28 20 | 30 20 29 3b 0a 0a 4e 6f |eturn ( |0 );..No|
|00000840| 74 65 20 74 68 61 74 20 | 74 68 69 73 20 77 6f 75 |te that |this wou|
|00000850| 6c 64 20 6d 65 61 6e 20 | 63 68 61 6e 67 69 6e 67 |ld mean |changing|
|00000860| 20 74 68 65 20 72 65 74 | 75 72 6e 20 74 79 70 65 | the ret|urn type|
|00000870| 20 6f 66 20 74 68 65 20 | 66 75 6e 63 74 69 6f 6e | of the |function|
|00000880| 20 74 6f 0a 69 6e 64 69 | 63 61 74 69 6e 67 20 77 | to.indi|cating w|
|00000890| 68 65 74 68 65 72 20 6f | 72 20 6e 6f 74 20 74 68 |hether o|r not th|
|000008a0| 65 20 69 74 65 6d 20 77 | 61 73 20 66 6f 75 6e 64 |e item w|as found|
|000008b0| 20 61 6e 64 20 64 65 6c | 65 74 65 64 2e 0a 0a 0a | and del|eted....|
|000008c0| 54 61 72 61 6e 67 0a | |Tarang. | |
+--------+-------------------------+-------------------------+--------+--------+